package com.bnz.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class CartItem {

    private Dessert dessert;    //所购买的某件商品
    private int num;            //购买的某件商品的数量
    private double total;       //某见商品的总金额

    public CartItem(Dessert dessert, int num) {
        this.dessert = dessert;
        this.num = num;
    }

    public void setTotal(double total) {
        this.total = this.num * dessert.getPrice();
    }
}
